package com.zallds.window;

import com.zallds.utils.Utils;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * 滚动计数窗口演示
 * 火车站有很多测温口,每当这个顾客被测温3次就返回最高体温
 */
public class TumblingCountWindowDemo {

    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.socketTextStream("192.168.62.37",8889)
                .flatMap(new Utils.Splitter())
                .keyBy(value -> value.f0)
                .countWindow(3)
                .maxBy(1)
                .print("每测量3个旅客，红外测温仪探测到的体温最高的旅客信息是 ->");

        env.execute();
    }
}
